<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加公告</title>
<link rel="stylesheet" type="text/css" href="css/css.css" />


</head>
<body>
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<span><a href="user.html">首页</a></span>&nbsp;-&nbsp;添加公告
			</div>
		</div>
		<div class="page" id="app">
			<!-- 会员注册页面样式 -->
			<div class="banneradd bor">
				<div class="baTopNo">
					<span>添加公告</span>
				</div>
				<div class="baBody">
					<div class="note">
						公告详情:<br><input style="width:800px;height:50px;" type="text" v-model="note.note" />
					</div>  
					<div class="bbD">
						日&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;期：&nbsp;<input type="text" class="input3" v-model="note.nodate"/>
					</div>
					<div class="bbD">
						<p class="bbDP">
							<button @click="add" class="btn_ok btn_yes" href="#">提交</button>
						</p>
					</div>


				</div>
			</div>

			<!-- 添加管理员页面样式end -->
		</div>
	</div>
</body>



<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.5.0"></script>
<script>
	new Vue({
	  el: '#app',
	  data() {
		  return {
			  note: {
				note: '',
				nodate: ''
			  }
		  }
	  },
	  methods: {
		  add: function() {
			if(!this.note.note) {
				alert('详情不能为空');
				return;
			}
			if(!this.note.nodate) {
				alert('日期不能为空');
				return;
			}
			this.$http.post(`http://localhost:8080/note/add`,this.note)
			.then(
				res =>{
					let data = res.body;
					if(data.code === '200') {
						alert('添加成功');
					}else {
						alert(data.desc);
					}
				},
				res =>{
					alert(`网络异常`);
				}
			);
		  }
	  }
  });
</script>
</html>